package com.tianji.learning.controller;

import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.query.ReplyPageQuery;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Api(tags = "互动回答相关接口-后台评论管理")
@RestController
@RequestMapping("/admin")
@RequiredArgsConstructor
public class AdminReplyController {
    private final IInteractionReplyService interactionReplyService;

    @PutMapping("/replies/{id}/hidden/{hidden}")
    @ApiOperation("修改回答隐藏状态")
    void updateReplyHidden(@PathVariable("id") Long id, @PathVariable("hidden") Boolean hidden) {
        interactionReplyService.updateReplyHidden(id, hidden);
    }

    @GetMapping("/replies/page")
    @ApiOperation("分页查询互动回答列表")
    PageDTO<ReplyVO> getReplyPage(ReplyPageQuery query){
        return interactionReplyService.getReplyPage(query,true);
    }

}
